<?php
echo '<?xml version="1.0" encoding="utf-8"?>'."\n";
echo $this->doctype('<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">')."\n";
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php
// title
$title = 'Cocktail Rezepte vom cocktailberater';
if($this->layout()->getView()->title!='') {
	$title =  strip_tags($this->layout()->getView()->title). ' vom cocktailberater';
}
echo $this->headTitle($title)."\n";
// meta
// setting content type and character set
$this->headMeta()->appendHttpEquiv('Content-Type','text/html; charset=utf-8');
header('Content-Type: text/html; charset=utf-8');
// setting client-side cache
// also enable caching in HTTP header
// seconds, minutes, hours, days
$expires = 60*60*24*7;
$this->headMeta()->appendHttpEquiv('Expires', 
					gmdate('D, d M Y H:i:s', time()+$expires) . ' GMT');
header('Expires: ' . gmdate('D, d M Y H:i:s', time()+$expires) . ' GMT');
$this->headMeta()->appendHttpEquiv('Cache-Control', 'max-age='.$expires);
$this->headMeta()->appendHttpEquiv('Cache-Control', 'private');
header('Cache-Control: private; max-age='.$expires);
 // setting meta generator
$this->headMeta()->setName('generator', 'cocktailberater version '.APPLICATION_VERSION);
// setting meta robots
$this->headMeta()->setName('robots', 'index,follow');
// setting meta viewport
// $this->headMeta()->setName('viewport', 'width = device-width, height = device-height, initial-scale = 1, maximum-scale = 1');
// setting google verification
$this->headMeta()->setName('google-site-verification', 'L3zaslftTHZhIO01_Og9b-KvBNM7mecVfIyMMcj2IdM');
echo $this->headMeta();
// echo styles
echo $this->headStyle()."\n";
// css style sheets
$this->headLink()->appendStylesheet($this->baseUrl().'/css/mobile.css');
// faveicon
$this->headLink(array('rel' => 'shortcut icon',
                      'href' => $this->baseUrl().'/favicon.ico'),
                      'PREPEND');
// feed of blog (rss & atom)
$this->headLink(array('rel' => 'alternate',
					  'type' => 'application/atom+xml',
					  'title' => 'cocktailberater.de Blog - Atom',
                      'href' => 'http://blog.cocktailberater.de/feeds/posts/default'));
$this->headLink(array('rel' => 'alternate',
					  'type' => 'application/rss+xml',
					  'title' => 'cocktailberater.de Blog - RSS',
                      'href' => 'http://blog.cocktailberater.de/feeds/posts/default?alt=rss'));
// e.g. for facebook sharing
$this->headLink(array('rel' => 'image_src',
					  'type' => 'image/jpeg',
                      'href' => 'http://www.cocktailberater.de/img/logo.png'));
// echo css, faveicon and feeds
echo $this->headLink()."\n";

$homePage = array('module'=>'website','controller'=>'index','action'=>'index');
?>
</head>
<body>
<a id="header" href="<?php print $this->url($homePage,'default',true); 
	?>?format=mobile"><span class="hide">Startseite</span></a>
<h1 class="hide">cocktailberater</h1>
<div id="wrapper">
<?php
// load whole navigation structure for breadcrumb 
// and subset for menu
$portalNavigationConfig = new Zend_Config_Ini(APPLICATION_PATH.
				 '/modules/website/config/portal-navigation.ini','nav');
$portalNoMenuConfig = new Zend_Config_Ini(APPLICATION_PATH.
					'/modules/website/config/portal-no-menu.ini','nav');
$breadCrumbContainer = new Zend_Navigation($portalNavigationConfig);
$menuContainer = $breadCrumbContainer;
$breadCrumbContainer->addPages($portalNoMenuConfig);
$controllersForSearch = array('recipe','cocktail','index');
$currentController = Zend_Controller_Front::getInstance()->
					getRequest()->getControllerName();
?>
<p class="breadcrumb">
	<?php
	
	// replace 'Zutat' in breadcrumb with specific ingredient
	if($breadCrumbContainer->findOneBy('label', 'Zutat')){
		$ingredientPage = $breadCrumbContainer->findOneBy('label', 'Zutat');
		$ingredientPage->setParams(array('id' => Zend_Controller_Front::getInstance()->getRequest()->
				getParam('id')));
		$ingredientPage->setLabel($this->placeholder('label')->toString());
	}
	// replace 'Zutatenkategorie' in breadcrumb with specific ingredient-category
	if($breadCrumbContainer->findOneBy('label', 'Zutatenkategorie')){
		$ingredientCategoryPage = $breadCrumbContainer->findOneBy('label', 'Zutatenkategorie');
		$ingredientCategoryPage->setParams(array('id' => Zend_Controller_Front::getInstance()->getRequest()->
				getParam('id')));
		$ingredientCategoryPage->setLabel($this->placeholder('label')->toString());
	}
	// replace 'Produkt' in breadcrumb with specific product
	if($breadCrumbContainer->findOneBy('label', 'Produkt')){
		$productPage = $breadCrumbContainer->findOneBy('label', 'Produkt');
		$productPage->setParams(array('id' => Zend_Controller_Front::getInstance()->getRequest()->
				getParam('id')));
		$productPage->setLabel($this->placeholder('label')->toString());
	}
	// replace '_Hersteller_' in breadcrumb with specific manufacturer
	if($breadCrumbContainer->findOneBy('label', '_Hersteller_')){
		$manufacturerPage = $breadCrumbContainer->findOneBy('label', '_Hersteller_');
		$manufacturerPage->setParams(array('id' => Zend_Controller_Front::getInstance()->getRequest()->
				getParam('id')));
		$manufacturerPage->setLabel($this->placeholder('label')->toString());
	}
	// print breadcrumb with specific resource format
	print $this->navigation($breadCrumbContainer)->breadcrumbs()->
			setPartial(array('template/breadcrumbs.phtml', 'website'))->
			renderPartial(); ?>
	<a href="#navigation">[zur Navigation]</a>
</p>
<?php
if(in_array($currentController, $controllersForSearch)) { 
	echo $this->partial ("template/search.mobile.phtml"); 
}
?>
<div id="content"><?php print $this->layout()->content ?></div>
<h2 id="navigation">Navigation</h2>
<div class="sub_nav">
<?php 
// select subpart of menu container to render
$communityPages = $this->navigation($menuContainer)->
					findOneByLabel('Startseite'); 
print $this->navigation()->menu()->
		renderPartial($communityPages,
		'template/portal_nav.phtml'); 
?>
</div>
<h2 id="social" class="abstand_oben">Social</h2>
<ul class="no-bullet">
	<li id="social_become_fan"><a 
		href="http://www.facebook.com/cocktailberater" 
		title="auf facebook Fan werden"><span class="social_sprites" 
		id="spr_facebook_fan"></span> Fan werden</a></li>
	<li id="social_share"><a 
		href="http://www.facebook.com/sharer.php?u=<?php 
		?>http://www.cocktailberater.de<?php echo $this->url(); 
		?>&amp;t=<?php echo urlencode($title); ?>" 
		title="auf facebook teilen"> <span class="social_sprites" 
		id="spr_facebook_share"></span> Teilen</a></li>
	<li id="social_twitter"><a href="http://twitter.com/home<?php
		?>?status=<?php echo urlencode($title . 
		': http://www.cocktailberater.de' . $this->url()); ?>" 
		title="auf Twitter posten"> <span class="social_sprites" 
		id="spr_twitter"></span>Twitter(n)</a></li>
</ul>
<p class="abstand_oben">
	[ <a href="?format=html">Komplette Seite</a> ]
</p>
<?php if(APPLICATION_ENV=='production') { ?>
<!-- Piwik -->
<script type="text/javascript">
	var pkBaseURL = (("https:" == document.location.protocol) ? <?php 
		?>"https://stats.thobach.de/" : "http://stats.thobach.de/");
	document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' <?php 
		?>type='text/javascript'%3E%3C/script%3E"));
	try {
		var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", 4);
		piwikTracker.trackPageView();
		piwikTracker.enableLinkTracking();
	} catch( err ) {}
</script>
<noscript>
<p><img src="http://stats.thobach.de/piwik.php?idsite=4"
	style="border: 0" alt="" /></p>
</noscript>
<!-- End Piwik Tag -->
<?php } ?>
</div>
</body>
</html>
